<%@page import="entity.Movie"%>
<%@page import="java.io.OutputStream"%>
<%@page import="java.io.FileInputStream"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%		
		Movie movie=(Movie)request.getAttribute("movie");
		String filename=movie.getPlayurl();
		System.out.println(filename);
		String[] str= filename.split("/");
		filename=str[1];
		System.out.println(filename);
		String path = application.getRealPath("video")+"/"+filename;
		
		
		response.setContentType("application/x-msdownload");
		response.setHeader("Content-disposition", 
				"attachment; filename="+filename);
		
		FileInputStream fis = new FileInputStream(path);
		OutputStream os = response.getOutputStream(); 
		byte[] buff = new byte[100];
		int length;
		while((length = fis.read(buff)) !=-1){
			os.write(buff,0,length);
		}
		os.flush();
		fis.close();
	
 %>
